package com.hengpeng.itfinbase.persist;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputType;
import com.hengpeng.itfinbase.idAssign.AbstractAssign18IdEntity;

@Entity
public class MessageTemplates extends AbstractAssign18IdEntity{
    private static final long serialVersionUID = 3079913042130554028L;
    private Date time;
    private String scenarios;
    private String title;
    private String content;
    private Integer status;
    private Integer type;
    
    
    @Column(length = 20)
    @HtmlInput(label = "类型", type = HtmlInputType.TEXT, nullable = true, index = 3,labelProperty="text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private BusiType  busiType;
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }
    public String getScenarios() {
        return scenarios;
    }
    public void setScenarios(String scenarios) {
        this.scenarios = scenarios;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    
    
    public BusiType getBusiType() {
        return busiType;
    }
    public void setBusiType(BusiType busiType) {
        this.busiType = busiType;
    }


    /**
     * 业务通知类型
     * @author Administrator
     *
     */
    public static enum BusiType{
        M110("用户注册成功"),
        M210("提现成功"),
        M211("提现失败"),
        M310("充值成功"),
        M311("充值失败"),
        M410("投资成功"),
        M411("投资失败"),
        M510("还款成功"),
        M511("还款失败"),
        M610("放款成功"),
        M611("放款失败")
        ;
        private String text;
        BusiType(String text)
        {
            this.text = text;
        }

        public String getText()
        {
            return text;
        }

        public void setText(String text)
        {
            this.text = text;
        }
        
        public static BusiType getBusiTypeByName(String name){
            for(BusiType busiType:BusiType.values()){
                if(name.equals(busiType.name())){
                    return busiType;
                }
                
            }
            return null;
        }
    }
}
